//////////////////////////////////////////////////////////////
//
//  Description	: PDF2HTML/BMP software
//  Author	: verypdf.com Inc
//  Version	: Ver1.2
//  Platform	: Windows95/98/Me/NT/2000/XP
//  Environment	: Visual C++ 6.0
//  Date	: 2002/04/03
//
//  Copyright(C) 2000--2003 verypdf.com Inc
//      
//  Contact infomation:
//        http://www.verypdf.com/
//        support@verypdf.com
//
//  This program is shareware; you can redistribute and/or 
//  modify it under the terms of the GNU General Public License.
//  See the GNU General Public License for more details.
//
//               Portion base on Xpdf code
//         Copyright 1996-2003 Glyph && Cog, LLC
//////////////////////////////////////////////////////////////

#ifndef FORMWIDGET_H
#define FORMWIDGET_H

#ifdef __GNUC__
#pragma interface
#endif

class XRef;
class Gfx;

//------------------------------------------------------------------------
// FormWidget
//------------------------------------------------------------------------

class FormWidget 
{
public:
	
	FormWidget(XRef *xrefA, Dict *dict);
	~FormWidget();
	GBool isOk() { return ok; }
	
	void draw(Gfx *gfx);
	
	// Get appearance object.
	Object *getAppearance(Object *obj) { return appearance.fetch(xref, obj); }
	
private:
	
	XRef	*xref;			// the xref table for this PDF file
	Object	appearance;		// a reference to the Form XObject stream
					//   for the normal appearance
	double	xMin, yMin,		// widget rectangle
		xMax, yMax;
	GBool	ok;
//Add by xueheng for "..." at 2002/05/01,begin
	GfxRGB	m_nRGBColor;
//Add by xueheng for "..." at 2002/05/01,end
};

//------------------------------------------------------------------------
// FormWidgets
//------------------------------------------------------------------------
class FormWidgets 
{
public:
	
	// Extract widgets from array of annotations.
	FormWidgets(XRef *xref, Object *annots);
	
	~FormWidgets();
	
	// Iterate through list of widgets.
	int getNumWidgets() { return nWidgets; }
	FormWidget *getWidget(int i) { return widgets[i]; }
	
private:
	
	FormWidget **widgets;
	int nWidgets;
};

#endif
